package cwinsor.com.leaf_raking;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import cwinsor.com.leaf_raking.Person.Format;

public class FileTypeAppointmentSchedule extends FileType {

	/* 
	 * local variables - column numbers
	 */

	protected Integer colPersonType;
	protected Integer colFirstName;
	protected Integer colLastName;
	protected Integer colPhoneC;
	protected Integer colPhoneH;


	/**
	 * constructor
	 */
	public FileTypeAppointmentSchedule() {

		// establish column numbers

		colPersonType = 1;
		colFirstName = 2;
		colLastName = 3;
		colPhoneC = 4;
		colPhoneH = 5;
	}


	// name
	public String getName() { return "FileTypeState"; }

	///////////////
	// column getters

	public Integer colPersonType() { return colPersonType; }
	public Integer colFirstName() { return colFirstName; }
	public Integer colLastName() { return colLastName; }
	public Integer colPhoneC() { return colPhoneC; }
	public Integer colPhoneH() { return colPhoneH; }


	/*
	 * populate data from array of fields
	 */
	@Override
	public void doPopulate(
			ArrayList<String> theFieldsObject,
			ArrayList<Person> persons,
			Boolean supervisors) {

		Msg.fatal(dS + ": not supported from FileTypeAppointmentSchedule");
	}


	@Override
	protected void doWriteToFile(Person person, PrintWriter writer,
			Format format) {

		String foo = new String();
		foo = foo + person.getType();
		foo = foo + "," + person.getFirstName();
		foo = foo + "," + person.getLastName();
		foo = foo + "," +  person.getPhoneC();
		foo = foo + "," + person.getPhoneH();	
		writer.write(foo + "\n");
			}


	public void toStringCommaDelimitedAllFieldsMid(Map<Integer,String> theFieldsObject, Person person) {

		theFieldsObject.put(colPersonType(), person.getType());
		theFieldsObject.put(colFirstName(), person.getFirstName());
		theFieldsObject.put(colLastName(), person.getLastName());
		theFieldsObject.put(colPhoneC(), person.getPhoneC());
		theFieldsObject.put(colPhoneH(), person.getPhoneH());	
		return;
	}

	@Override
	protected void doApplySchedulePreferenceUpdates(ArrayList<String> theFieldsObject,
			PrsnList personList) {

		Msg.fatal(dS + ": not supported");
	}


	// debug
	String dS = this.getClass().getSimpleName();
}

